/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package pe.edu.upc.upcdewtaxiremisse.controller;
import java.io.IOException;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.springframework.context.ApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;
import pe.edu.upc.upcdewtaxiremisse.model.Liquidacion;
import pe.edu.upc.upcdewtaxiremisse.service.LiquidacionService;
import pe.edu.upc.upcdewtaxiremisse.service.LiquidacionServiceImpl;

/**
 *
 * @author hflores
 */
public class LiquidacionServlet extends HttpServlet {
   private LiquidacionService liquidacionService;

@Override
    public void init(ServletConfig config) throws ServletException {
        ApplicationContext context = WebApplicationContextUtils.getWebApplicationContext(config.getServletContext());
        this.liquidacionService = (LiquidacionService) context.getBean("liquidacionService");
    }   

@Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

             String fechaProgramacion = req.getParameter("txtfechaliquidacion");
             LiquidacionService liquidacionService = new LiquidacionServiceImpl();
             Liquidacion liquidacion = liquidacionService.listarServicios(fechaProgramacion);

             req.setAttribute("liquidacion", liquidacion);

             req.getRequestDispatcher("Liquidacion_Servicio.jsp").forward(req, resp);
    }
}

